![]() |
AOMedia AV1 Codec
|
Describes the aom image descriptor and associated operations. More...
#include "aom/aom_integer.h"
Go to the source code of this file.
Data Structures | |
struct | aom_metadata |
Metadata payload. More... | |
struct | aom_image |
Image Descriptor. More... | |
Macros | |
#define | AOM_IMAGE_ABI_VERSION |
Current ABI version number. | |
#define | AOM_IMG_FMT_PLANAR 0x100 |
#define | AOM_IMG_FMT_UV_FLIP 0x200 |
#define | AOM_IMG_FMT_HIGHBITDEPTH 0x800 |
#define | AOM_HAVE_IMG_FMT_NV12 1 |
Allows detection of the presence of AOM_IMG_FMT_NV12 at compile time. | |
#define | AOM_PLANE_PACKED 0 |
#define | AOM_PLANE_Y 0 |
#define | AOM_PLANE_U 1 |
#define | AOM_PLANE_V 2 |
Typedefs | |
typedef enum aom_img_fmt | aom_img_fmt_t |
List of supported image formats. | |
typedef enum aom_color_primaries | aom_color_primaries_t |
List of supported color primaries. | |
typedef enum aom_transfer_characteristics | aom_transfer_characteristics_t |
List of supported transfer functions. | |
typedef enum aom_matrix_coefficients | aom_matrix_coefficients_t |
List of supported matrix coefficients. | |
typedef enum aom_color_range | aom_color_range_t |
List of supported color range. | |
typedef enum aom_chroma_sample_position | aom_chroma_sample_position_t |
List of chroma sample positions. | |
typedef enum aom_metadata_insert_flags | aom_metadata_insert_flags_t |
List of insert flags for Metadata. | |
typedef struct aom_metadata_array | aom_metadata_array_t |
Array of aom_metadata structs for an image. | |
typedef struct aom_metadata | aom_metadata_t |
Metadata payload. | |
typedef struct aom_image | aom_image_t |
Image Descriptor. | |
Functions | |
aom_image_t * | aom_img_alloc (aom_image_t *img, aom_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align) |
Open a descriptor, allocating storage for the underlying image. | |
aom_image_t * | aom_img_wrap (aom_image_t *img, aom_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align, unsigned char *img_data) |
Open a descriptor, using existing storage for the underlying image. | |
aom_image_t * | aom_img_alloc_with_border (aom_image_t *img, aom_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align, unsigned int size_align, unsigned int border) |
Open a descriptor, allocating storage for the underlying image with a border. | |
int | aom_img_set_rect (aom_image_t *img, unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int border) |
Set the rectangle identifying the displayed portion of the image. | |
void | aom_img_flip (aom_image_t *img) |
Flip the image vertically (top for bottom) | |
void | aom_img_free (aom_image_t *img) |
Close an image descriptor. | |
int | aom_img_plane_width (const aom_image_t *img, int plane) |
Get the width of a plane. | |
int | aom_img_plane_height (const aom_image_t *img, int plane) |
Get the height of a plane. | |
int | aom_img_add_metadata (aom_image_t *img, uint32_t type, const uint8_t *data, size_t sz, aom_metadata_insert_flags_t insert_flag) |
Add metadata to image. | |
const aom_metadata_t * | aom_img_get_metadata (const aom_image_t *img, size_t index) |
Return a metadata payload stored within the image metadata array. | |
size_t | aom_img_num_metadata (const aom_image_t *img) |
Return the number of metadata blocks within the image. | |
void | aom_img_remove_metadata (aom_image_t *img) |
Remove metadata from image. | |
aom_metadata_t * | aom_img_metadata_alloc (uint32_t type, const uint8_t *data, size_t sz, aom_metadata_insert_flags_t insert_flag) |
Allocate memory for aom_metadata struct. | |
void | aom_img_metadata_free (aom_metadata_t *metadata) |
Free metadata struct. | |
Describes the aom image descriptor and associated operations.
#define AOM_IMG_FMT_PLANAR 0x100 |
Image is a planar format.
#define AOM_IMG_FMT_UV_FLIP 0x200 |
V plane precedes U in memory.
#define AOM_IMG_FMT_HIGHBITDEPTH 0x800 |
0x400 used to signal alpha channel, skipping for backwards compatibility. Image uses 16bit framebuffer.
#define AOM_PLANE_PACKED 0 |
To be used for all packed formats
#define AOM_PLANE_Y 0 |
Y (Luminance) plane
Referenced by av1_apply_temporal_filter_c(), av1_interpolation_filter_search(), av1_nonrd_pick_inter_mode_sb(), av1_nonrd_pick_intra_mode(), av1_rd_pick_intra_sbuv_mode(), av1_rd_pick_intra_sby_mode(), av1_rd_pick_partition(), av1_receive_raw_frame(), fast_interp_search(), pick_sb_modes(), pick_sb_modes_nonrd(), prune_zero_mv_with_sse(), search_filter_ref(), and tf_setup_filtering_buffer().
#define AOM_PLANE_U 1 |
U (Chroma) plane
Referenced by av1_apply_temporal_filter_c(), av1_interpolation_filter_search(), av1_nonrd_pick_inter_mode_sb(), av1_rd_pick_intra_mode_sb(), av1_rd_pick_intra_sbuv_mode(), av1_search_intra_uv_modes_in_interframe(), av1_search_palette_mode(), fast_interp_search(), pick_sb_modes_nonrd(), and process_compound_inter_mode().
#define AOM_PLANE_V 2 |
V (Chroma) plane
Referenced by av1_interpolation_filter_search(), av1_nonrd_pick_inter_mode_sb(), fast_interp_search(), and pick_sb_modes_nonrd().
typedef enum aom_img_fmt aom_img_fmt_t |
List of supported image formats.
alias for enum aom_img_fmt
typedef enum aom_color_primaries aom_color_primaries_t |
List of supported color primaries.
alias for enum aom_color_primaries
List of supported transfer functions.
alias for enum aom_transfer_characteristics
typedef enum aom_matrix_coefficients aom_matrix_coefficients_t |
List of supported matrix coefficients.
alias for enum aom_matrix_coefficients
typedef enum aom_color_range aom_color_range_t |
List of supported color range.
alias for enum aom_color_range
typedef enum aom_chroma_sample_position aom_chroma_sample_position_t |
List of chroma sample positions.
alias for enum aom_chroma_sample_position
typedef enum aom_metadata_insert_flags aom_metadata_insert_flags_t |
List of insert flags for Metadata.
These flags control how the library treats metadata during encode.
While encoding, when metadata is added to an aom_image via aom_img_add_metadata(), the flag passed along with the metadata will determine where the metadata OBU will be placed in the encoded OBU stream, and whether it's layer-specific. Metadata will be emitted into the output stream within the next temporal unit if it satisfies the specified insertion flag.
If the video contains multiple spatial and/or temporal layers, a layer-specific metadata OBU only applies to the current frame's layer, as determined by the frame's temporal_id and spatial_id. Some metadata types cannot be layer-specific, as listed in Section 6.7.1 of the draft AV1 specification as of 2025-03-06.
During decoding, when the library encounters a metadata OBU, it is emitted with the next output aom_image. Its insert_flag is set to either AOM_MIF_ANY_FRAME, or AOM_MIF_ANY_FRAME_LAYER_SPECIFIC if the OBU contains an OBU header extension (i.e. the video contains multiple layers AND the metadata was added using *_LAYER_SPECIFC insert flag if using libaom).
typedef struct aom_image aom_image_t |
Image Descriptor.
alias for struct aom_image
enum aom_img_fmt |
List of supported image formats.
enum aom_color_primaries |
List of supported color primaries.
List of supported transfer functions.
List of supported matrix coefficients.
enum aom_color_range |
List of supported color range.
List of insert flags for Metadata.
These flags control how the library treats metadata during encode.
While encoding, when metadata is added to an aom_image via aom_img_add_metadata(), the flag passed along with the metadata will determine where the metadata OBU will be placed in the encoded OBU stream, and whether it's layer-specific. Metadata will be emitted into the output stream within the next temporal unit if it satisfies the specified insertion flag.
If the video contains multiple spatial and/or temporal layers, a layer-specific metadata OBU only applies to the current frame's layer, as determined by the frame's temporal_id and spatial_id. Some metadata types cannot be layer-specific, as listed in Section 6.7.1 of the draft AV1 specification as of 2025-03-06.
During decoding, when the library encounters a metadata OBU, it is emitted with the next output aom_image. Its insert_flag is set to either AOM_MIF_ANY_FRAME, or AOM_MIF_ANY_FRAME_LAYER_SPECIFIC if the OBU contains an OBU header extension (i.e. the video contains multiple layers AND the metadata was added using *_LAYER_SPECIFC insert flag if using libaom).
aom_image_t * aom_img_alloc | ( | aom_image_t * | img, |
aom_img_fmt_t | fmt, | ||
unsigned int | d_w, | ||
unsigned int | d_h, | ||
unsigned int | align ) |
Open a descriptor, allocating storage for the underlying image.
Returns a descriptor for storing an image of the given format. The storage for the image is allocated on the heap.
[in] | img | Pointer to storage for descriptor. If this parameter is NULL, the storage for the descriptor will be allocated on the heap. |
[in] | fmt | Format for the image |
[in] | d_w | Width of the image. Must not exceed 0x08000000 (2^27). |
[in] | d_h | Height of the image. Must not exceed 0x08000000 (2^27). |
[in] | align | Alignment, in bytes, of the image buffer and each row in the image (stride). Must not exceed 65536. |
aom_image_t * aom_img_wrap | ( | aom_image_t * | img, |
aom_img_fmt_t | fmt, | ||
unsigned int | d_w, | ||
unsigned int | d_h, | ||
unsigned int | align, | ||
unsigned char * | img_data ) |
Open a descriptor, using existing storage for the underlying image.
Returns a descriptor for storing an image of the given format. The storage for the image has been allocated elsewhere, and a descriptor is desired to "wrap" that storage.
[in] | img | Pointer to storage for descriptor. If this parameter is NULL, the storage for the descriptor will be allocated on the heap. |
[in] | fmt | Format for the image |
[in] | d_w | Width of the image. Must not exceed 0x08000000 (2^27). |
[in] | d_h | Height of the image. Must not exceed 0x08000000 (2^27). |
[in] | align | Alignment, in bytes, of each row in the image (stride). Must not exceed 65536. |
[in] | img_data | Storage to use for the image. The storage must outlive the returned image descriptor; it can be disposed of after calling aom_img_free(). |
aom_image_t * aom_img_alloc_with_border | ( | aom_image_t * | img, |
aom_img_fmt_t | fmt, | ||
unsigned int | d_w, | ||
unsigned int | d_h, | ||
unsigned int | align, | ||
unsigned int | size_align, | ||
unsigned int | border ) |
Open a descriptor, allocating storage for the underlying image with a border.
Returns a descriptor for storing an image of the given format and its borders. The storage for the image is allocated on the heap.
[in] | img | Pointer to storage for descriptor. If this parameter is NULL, the storage for the descriptor will be allocated on the heap. |
[in] | fmt | Format for the image |
[in] | d_w | Width of the image. Must not exceed 0x08000000 (2^27). |
[in] | d_h | Height of the image. Must not exceed 0x08000000 (2^27). |
[in] | align | Alignment, in bytes, of the image buffer and each row in the image (stride). Must not exceed 65536. |
[in] | size_align | Alignment, in pixels, of the image width and height. Must not exceed 65536. |
[in] | border | A border that is padded on four sides of the image. Must not exceed 65536. |
int aom_img_set_rect | ( | aom_image_t * | img, |
unsigned int | x, | ||
unsigned int | y, | ||
unsigned int | w, | ||
unsigned int | h, | ||
unsigned int | border ) |
Set the rectangle identifying the displayed portion of the image.
Updates the displayed rectangle (aka viewport) on the image surface to match the specified coordinates and size. Specifically, sets img->d_w, img->d_h, and elements of the img->planes[] array.
[in] | img | Image descriptor |
[in] | x | leftmost column |
[in] | y | topmost row |
[in] | w | width |
[in] | h | height |
[in] | border | A border that is padded on four sides of the image. |
void aom_img_flip | ( | aom_image_t * | img | ) |
Flip the image vertically (top for bottom)
Adjusts the image descriptor's pointers and strides to make the image be referenced upside-down.
[in] | img | Image descriptor |
void aom_img_free | ( | aom_image_t * | img | ) |
Close an image descriptor.
Frees all allocated storage associated with an image descriptor.
[in] | img | Image descriptor |
int aom_img_plane_width | ( | const aom_image_t * | img, |
int | plane ) |
Get the width of a plane.
Get the width of a plane of an image
[in] | img | Image descriptor |
[in] | plane | Plane index |
int aom_img_plane_height | ( | const aom_image_t * | img, |
int | plane ) |
Get the height of a plane.
Get the height of a plane of an image
[in] | img | Image descriptor |
[in] | plane | Plane index |
int aom_img_add_metadata | ( | aom_image_t * | img, |
uint32_t | type, | ||
const uint8_t * | data, | ||
size_t | sz, | ||
aom_metadata_insert_flags_t | insert_flag ) |
Add metadata to image.
Adds metadata to aom_image_t. Function makes a copy of the provided data parameter. Metadata insertion point is controlled by insert_flag.
[in] | img | Image descriptor |
[in] | type | Metadata type |
[in] | data | Metadata contents |
[in] | sz | Metadata contents size |
[in] | insert_flag | Metadata insert flag |
const aom_metadata_t * aom_img_get_metadata | ( | const aom_image_t * | img, |
size_t | index ) |
Return a metadata payload stored within the image metadata array.
Gets the metadata (aom_metadata_t) at the indicated index in the image metadata array.
[in] | img | Pointer to image descriptor to get metadata from |
[in] | index | Metadata index to get from metadata array |
size_t aom_img_num_metadata | ( | const aom_image_t * | img | ) |
Return the number of metadata blocks within the image.
Gets the number of metadata blocks contained within the provided image metadata array.
[in] | img | Pointer to image descriptor to get metadata number from. |
void aom_img_remove_metadata | ( | aom_image_t * | img | ) |
Remove metadata from image.
Removes all metadata in image metadata list and sets metadata list pointer to NULL.
[in] | img | Image descriptor |
aom_metadata_t * aom_img_metadata_alloc | ( | uint32_t | type, |
const uint8_t * | data, | ||
size_t | sz, | ||
aom_metadata_insert_flags_t | insert_flag ) |
Allocate memory for aom_metadata struct.
Allocates storage for the metadata payload, sets its type and copies the payload data into the aom_metadata struct. A metadata payload buffer of size sz is allocated and sz bytes are copied from data into the payload buffer.
[in] | type | Metadata type |
[in] | data | Metadata data pointer |
[in] | sz | Metadata size |
[in] | insert_flag | Metadata insert flag |
void aom_img_metadata_free | ( | aom_metadata_t * | metadata | ) |
Free metadata struct.
Free metadata struct and its buffer.
[in] | metadata | Metadata struct pointer |